package com.wd.live.view.custom

import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import android.widget.Button
import com.blankj.utilcode.util.ToastUtils
import com.wd.live.R
import com.wd.live.view.activity.DialogActivity
import com.wd.live.view.activity.HomeActivity
import com.wd.live.view.activity.LookLiveActivity
import com.wd.live.view.activity.UploadActivity

/**
 * 作者：马海钊
 * 时间：2023/8/21 10:25
 * 功能：
 */
class CustomDialog_two(context: Context) : Dialog(context) {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.dialog_xiao_two)
        initWindow()
        initView()
    }
    private fun initView() {
        val checkTrue = findViewById<Button>(R.id.dialog_ok1)
        checkTrue.setOnClickListener {
            context.startActivity(Intent(context,DialogActivity::class.java))
        }
        val checkFalse = findViewById<Button>(R.id.dialog_no1)
        checkFalse.setOnClickListener {
            context.startActivity(Intent(context,HomeActivity::class.java))
        }
    }

    private fun initWindow() {
        val window = window
        if (window != null) {
            window.setGravity(Gravity.CENTER)
            window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))

            //获得window窗口的属性
            val lp = window.attributes
            lp.width = WindowManager.LayoutParams.MATCH_PARENT
            lp.height = WindowManager.LayoutParams.WRAP_CONTENT
            window.attributes = lp
        }
    }


}